/**
 * Copyright @ 2013 - 2015 Suntec Software(Shanghai) Co., Ltd.
 * All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are NOT permitted except as agreed by
 * Suntec Software(Shanghai) Co., Ltd.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 */

#include "Demo.h"
#include "qmlframework/NQRectangle.h"
#include "qmlframework/NQText.h"
#include "qmlframework/NQMouseArea.h"
#include "ngbase/NGLog.h"
#include "ngframeworkbase/NGAPI.h"
#include "qmlframework/NQAPI.h"

Demo::Demo(QQuickItem *parent)
    : NQView(parent)
{
}

Demo::~Demo()
{
}

void Demo::onBtnClicked(QVariant event)
{
    Q_UNUSED(event);
    NGLogDebug(APP_LogTag, "button press");
}

void Demo::onCreate()
{
    this->setClip(true);
    m_container = this->findChild<NQRectangle*>("view_home_container");
    m_btn = this->findChild<NQRectangle*>("view_home_btn");
    m_text = this->findChild<NQText*>("view_home_text");
    NQView::onCreate();
}

void Demo::onPreActive()
{
    NGLogDebug(APP_LogTag, "view demo will be actived");
    NQView::onPreActive();
}

void Demo::onActive()
{
    NGLogDebug(APP_LogTag, "view demo did actived");
    NQView::onActive();
}

void Demo::onPreDeactive()
{
    NGLogDebug(APP_LogTag, "view demo will be deactived");
    NQView::onPreDeactive();
}

void Demo::onDeactive()
{
    NGLogDebug(APP_LogTag, "view demo did deactived");
    NQView::onDeactive();
}

void Demo::onDestroy()
{
    m_container = NULL;
    m_btn = NULL;
    m_text = NULL;
    NQView::onDestroy();
}

/* EOF */
